﻿using HappyBa.Core.Reporting;
using HappyBa.Localization;
using Microsoft.Win32;

namespace HappyBa.Code
{
    class ReportFilePathGetter : IReportFilePathGetter
    {
        private static SaveFileDialog CreateDialog()
        {
            return new SaveFileDialog
            {
                FileName = HappyBaLang.ExcelReportFileName,
                CheckFileExists = false,
                DefaultExt = "xls",
                Title = HappyBaLang.PleaseChooseFileToSaveReport
            };
        }

        public bool Get(out string path)
        {
            var dialog = CreateDialog();
            var ret = dialog.ShowDialog();
            path = dialog.FileName;
            return ret == true;
        }
    }
}